package zuoye.ershouche.controller;


import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import zuoye.ershouche.common.Result;
import zuoye.ershouche.service.OrderServer;

@RestController
@Api(tags = "订单路由") //CarInfo
public class OrderController {

    @Autowired
    private OrderServer orderServer;

    @PostMapping("/makeOrder")
    @ApiOperation(value = "新建订单")
    public Result makeOrder(@RequestParam Integer userId, @RequestParam Integer shellId, @RequestParam Integer carId) {
        return Result.success(orderServer.insertOrder(userId, shellId, carId));
    }

    @PostMapping("/payOrder")
    @ApiOperation(value = "支付订单")
    public Result payOrder(@RequestParam Integer id) {
        return Result.success(orderServer.payOrder(id));
    }

    @PostMapping("/delOrder")
    @ApiOperation(value = "删除订单")
    public Result delOrder(@RequestParam Integer id) {
        return Result.success(orderServer.deleteOrder(id));
    }
}
